import { Column, Entity } from 'typeorm'
import { SoftCommonEntity } from '~/common/entity/common.entity'

@Entity({ name: 'c_book' })
export class BookEntity extends SoftCommonEntity {
  @Column({ name: 'book_name', type: 'varchar', length: 255, comment: '书本名称', default: '' })
  bookName: string

  @Column({ name: 'book_url', type: 'varchar', length: 255, comment: '书本pdf链接', default: '' })
  bookUrl: string

  @Column({ name: 'book_cover', type: 'varchar', length: 255, comment: '书本封面', default: '' })
  bookCover: string

  @Column({ name: 'book_grade', type: 'int', comment: '学级，0 幼儿园，1-6 小学，7-8 初中', default: 0 })
  bookGrade: number

  @Column({ name: 'book_audio_urls', type: 'text', comment: '书本音频文件', nullable: true })
  bookAudioUrls: string

  @Column({ name: 'book_split_content', type: 'text', comment: '书本音频切割内容', nullable: true })
  bookSplitContent: string

  @Column({ name: 'book_split_type', type: 'tinyint', comment: '音频切割类型，1 人工字幕 2 AI字幕', default: 1 })
  bookSplitType: number

  @Column({ name: 'book_tag_id', type: 'bigint', unsigned: true, comment: '标签ID', default: 0 })
  bookTagId: number

  // 非数据库字段，用于存储关联查询的标签名称
  tagName?: string
}
